export default function (global, console) {
  global.showCookies = function () {
    if (document.cookie) {
      const cookiesArr = document.cookie.split(/; ?/)
      const cookiesTable = cookiesArr.map((cookie) => ({
        Key: cookie.split('=')[0],
        Value: decodeURIComponent(cookie.split('=')[1]),
      }))

      console.group('Cookies')
      console.log(cookiesArr.map((cookie) => cookie.replace('=', ': ')).join('\n'))
      console.table(cookiesTable)
      console.groupEnd('Cookies')
    } else {
      console.log('no cookies.')
    }
  }
}
